<?php
/**
* エラーチェッククラス
**/
require_once( '../system/Class_M_DAO.php' );
class Class_D_DNPW_AREA_SHOP extends Class_M_DAO {
	//protected properties begin
	/**
	 *
	 * テーブル名
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	protected $_table = "D_DNPW_AREA_SHOP";
	protected $_table_pre = "D_DNPW_AREA";
	
	/**
	 *
	 * 主キー名
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	protected $_pkey = "id";
	
	/**
	 *
	 * ソート順
	 *
	 * @access    protected
	 * @var       string
	 *
	 */
	 protected $_order = "dnpid, shop_cd";
	 
	 protected $_cols     = array(
		"dnpid" => array(AOKI_VARTYPE_STR),
		"shop_cd"         => array(AOKI_VARTYPE_STR),
		"shop_per"        => array(AOKI_VARTYPE_STR),
		"shop_nums"       => array(AOKI_VARTYPE_STR)
	 );
	
	 protected $_checks  = array(
		"dnpid"         => array( "EXIST" ),
		"shop_cd"       => array( "EXIST" ),
		"shop_per"      => array( "EXIST", "NUM" ),
		"shop_nums"     => array( "EXIST", "NUM" ),
	 );
	 
	function setTableNameWeek($initid = "" ){
		$this->_tab_last_id = $initid;
		$this->_table       = $this->_table.$initid;
		$this->_table_pre   = $this->_table_pre.$initid;
	}
	
	function isExitsTable($intablename ="") {
		if ( empty( $intablename ) ) {
			$tabname = $this->_table;
			$sql = "show tables like '{$tabname}' ";
		} else {
			$sql = "show tables like '{$intablename}' ";
		}
		
		$this->_db->query( $sql );
		if( $this->_db->num_rows() ){
			return true;
		} else {
			return false;
		}
	}	 
	 //maxlength 
	 protected $_maxlens  = array( );
	 public function deleteShop( $matrixcd ) {
		$sql = "delete   sp from {$this->_table} sp ,{$this->_table_pre} ad where sp.dnpid = ad.id " ;
		return $this->exec_sql($sql) ;
	}
	
	
	/*
	 public function getAreaadByWeek( $matrixcd ) {
		$sql = " SELECT * FROM {$this->_table_pre} WHERE matrix_cd = '{$matrixcd}' ";
		$this->_db->query( $sql );
		if( $this->_db->num_rows() ){
			$data = array();
			while( $row = $this->_db->fetch() ){
				$data[$row["area_cd"]] = $row["id"];
			}
			return $data;
		}else{
			return  FALSE;
		}
	}
	*/
}

?>

